package com.vivo.common;

public class DatabaseContextHolder {
    private static final ThreadLocal<String> contextHolder = new ThreadLocal<String>();
    public static String curJdbcType = VivoStatus.JDBC_TYPE_MYSQL;

    public static void setDbType(String dataSourceType) {
        contextHolder.set(dataSourceType);
    }

    public static String getDbType() {
        return contextHolder.get();
    }

    public static void clearDbType() {
        contextHolder.remove();
    }


    public static void setMssqlAhDb() {
        contextHolder.set(VivoStatus.DATASOURCE_AHBBK_DB);
        curJdbcType = VivoStatus.JDBC_TYPE_MSSQL;
    }

    public static void setMainDb() {
        contextHolder.set(VivoStatus.DATASOURCE_MAIN_DB);
        curJdbcType = VivoStatus.JDBC_TYPE_MYSQL;
    }

    public static void setMssqlJsDb() {
        contextHolder.set(VivoStatus.DATASOURCE_JSBBK_DB);
        curJdbcType = VivoStatus.JDBC_TYPE_MSSQL;
    }
}
